<template>
	<view>
		<view v-for="(item,index) in list" :key="index" class="viewItem" @click="goPersonal(item.managerUserId)">
			<view>
				<image class="img" v-if='item.typeName!=undefined' :src="$global.getImageUrl(item.managerHeadImg,'https://ourydcimage.shenghua6.cn')" mode=""></image>
				<image class="img" v-else :src="$global.getImageUrl(item.headImg,'https://ourydcimage.shenghua6.cn')" mode=""></image>
			</view>
			<view class="left">
				<p class="name" v-if='item.typeName!=undefined'>【{{item.typeName}}】{{item.roomName}}</p>
				<p class="name" v-else>{{item.nickName}}</p>
				<p class="time">ID:{{item.identityId}}</p>
			</view>
			<view class="right">
				<!-- <p>></p> -->
			</view>
		</view>
		<uni-load-more :status="status" :content-text="contentText" />
	</view>
</template>

<script>
	import uniLoadMore from '../../components/uni-load-more/uni-load-more.vue';
	export default {
		components: {
			uniLoadMore
		},
		data() {
			return {
				status: 'loading',
				contentText: {
					contentdown: '上拉加载更多',
					contentrefresh: '加载中',
					contentnomore: '没有更多'
				},
				list: [],
				rows: 20,
				busy: true,
				scroll: 0,
				incomeType: 0,
				prop: 0,
				rowStart: 0,
				isLoadMore: false, //是否加载中
				keyword:''
			}
		},
		onLoad(option) {
			this.keyword=option.keyword
			this.loadMoreFunc();
		},
		onShow() {
			
		},
		// 上拉加载更多,onReachBottom上拉触底函数
		onReachBottom: function() {
			if (!this.isLoadMore) { //此处判断，上锁，防止重复请求
				this.isLoadMore = true
				this.rowStart ++ 
				this.loadMoreFunc();
			}

		},
		methods: {
			loadMoreFunc() {
				this.status = 'loading';
				var data = {
					url: '/web/v2/api/app/appSearchEx',
					methods: 'post',
					data: {
						// {"apiVersion":"2.2","identityId":"新手","page":"0","signature":"bZLZEqpmcbdvhKSNhg3nl66oY6o=","size":"10"}
						apiVersion: "2.2",
						page: this.rowStart,
						signature:"bZLZEqpmcbdvhKSNhg3nl66oY6o=",
						identityId: this.keyword
					}
				}
				this.$http(data).then(res => {
					if (res.data.code == 21000) {
						if (res.data.data.list.length) {
							this.list = this.list.concat(res.data.data.list)
							if (res.data.data.list.length == 0||res.data.data.list.length < 10) { //判断接口返回数据量小于请求数据量，则表示此为最后一页
								this.isLoadMore = true
								this.status = 'nomore'
							} else {
								this.isLoadMore = false
							}
						} else {
							this.isLoadMore = true
							this.status = 'nomore'
						}
					} else { //接口请求失败的处理
						uni.showToast({
							title: res.data.msg,
							icon: 'none'
						})
						this.isLoadMore = false
					}
				})
			},
			goPersonal(userId){
				
		// @click="goPath('/pages/subpage/chatRoomDetails/chatRoomDetails?roomId='+chat.roomId+'&channelId='+chat.channelId+'&identityId='+chat.identityId+'&onLineUser='+chat.onLineUser,chat.isPrivate,chat.roomId)
				
				 
				uni.showToast({
					title: '更多精彩请下载“哩咔”APP',
					icon: 'none',
					duration: 2000
				});
				// uni.navigateTo({
				// 	url:'/pages/subpage/personal/otherpersonal?userId='+userId
				// })
			}
		},
		mounted: function() {

		}
	}
</script>

<style lang="scss" scoped>
	.viewItem {
		margin: 0 30upx;
		padding: 27upx 0;
		display: flex;
		.img{
			width: 130upx;
			height: 130upx;
		}
	}

	.viewItem .top {
		width: 100%;
		height: 67upx;
		margin: 0 auto;
		display: flex;
		align-items: center;
		justify-content: space-between;
	}

	.viewItem .top .name {
		font-size: 37upx;
	}

	.viewItem .bottom {
		width: 100%;
		height: 67upx;
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin: 0 auto;
	}

	.viewItem .bottom .num {
		font-size: 37upx;
	}

	.none {
		position: fixed;
		left: 50%;
		top: 50%;
		transform: translate(-50%);
		font-size: 37upx;
	}
	.viewItem .left{
		margin-left: 20upx;
	}
	.viewItem .left .name {
		font-size: 32upx;
	}

	.viewItem .left .time {
		width: 180upx;
		text-align: center;
		font-size: 24upx;
		color: #999;
		background: rgba(197,197,197,0.6);
		margin-top: 30upx;
	}

	.viewItem .right {
		margin-left: auto;
		display: flex;
		align-items: center;
	}
</style>
